1. Field of the Invention
The present invention relates to displaying and formatting messages in a web application developed using JavaServer Faces (JSF).
2. Description of the Related Art
In the Java 2 Platform, Enterprise Edition (J2EE), Web components like Java servlets and JavaServer Pages (JSP) provide dynamic extension capabilities for a Web server. Servlets are Java programming language classes that dynamically process requests and construct responses. JSP pages are text-based documents that execute as servlets, but allow a more natural approach to creating static content. Although servlets and JSP pages can be used interchangeably, each has its own strengths. Servlets are best suited for service-oriented applications and the control functions of a presentation-oriented application, such as dispatching requests and handling non-textual data. JSP pages are more appropriate for generating text-based markup such as HTML, Scalable Vector Graphics (SVG), Wireless Markup Language (WML), and XML.
Web components are supported by the services of a runtime platform called a web container. A container provides an interface between the component and low-level platform-specific functionality that supports the component. Before a web component, enterprise bean, or application client component can be executed, it must be assembled into a module and deployed into its container. A Web container manages the execution of JSP page and servlet components for J2EE applications. More specifically, a web container provides services, such as request dispatching, security, concurrency and life-cycle management, and provides web components with access to application programming interfaces (APIs), such as naming, transactions, and email. Both the web components and their container run on the web server. When the web server runs the Java 2 Platform, Enterprise Edition (J2EE), it may be referred to as a J2EE server.
Since the introduction of Java Servlet and JSP technology, additional Java technologies and frameworks for building interactive web applications have been developed. JavaServer Faces (JSF), for example, is becoming the new standard for building server-side user interfaces for Web applications. JavaServer Faces technology includes a set of APIs for representing user interface (UI) components and managing their state, handling events and input validation, defining page navigation, and supporting internationalization and accessibility. A JavaServer Pages (JSP) custom tag library is also included for expressing a JavaServer Faces interface within a JSP page.
FIG. 1 is a schematic diagram of a prior art Web application server 10 in communication with a Web client 12 over a network 14, such as the Internet. The client sends an HTTP request 16 to the web server and receives an HTTP response 18 over the network. The web server 10 implements a Java Servlet component 20, a JavaServer Pages component 22, and a JavaServer Faces component 24 (including a JavaServer Pages standard tag library 26) in a web container 28. These web components can interact with JavaBean components 30, a database 32, or both to generate dynamic content. The web components can then generate a response or pass the request to another web component for response. Eventually one of the web components, in conjunction with the web server 10, generates the HTTP response 18 and returns it to the client 12.
FIG. 2 is a schematic diagram of prior art JSF process 40 including JSF phases 42 that result in a FacesMessage object 44 being sent to a JSP page 46. In JSF, messages are handled through a FacesMessages object 44 and the information in the message is displayed in a JSP web page 46 using <h:message> and <h:messages> tags.
However, JSF tags provide very little flexibility for formatting the message for display. For example, FIG. 3 is an illustration of a graphical display 50 produced by a JSP page having received prior art FacesMessages 52, 54 generated in accordance with FIG. 2. The FacesMessages 52, 54 are displayed as text in messages 56, 58, respectively.
However, it is very difficult to satisfy the dynamic formatting requirements of advanced web applications using existing JSF methods. Therefore, there is a need for a method to display messages in an easy, formattable manner. It would be desirable to have a method that combines the simplicity of using FacesMessage with advanced display and formatting features.